﻿using System.Windows.Forms;
using TestSystem.Model.Data;
using TestSystem.Ui.Controls;

namespace TestSystem.Ui.Helpers
{
    public static class UiHelper
    {
        public static TreeNode ToTreeNode(this Folder folder)
        {
            return new FolderTreeNode { Text = folder.Name, Tag = folder.Id, Name = folder.Id.ToString() };
        }

        public static TreeNode ToTreeNode(this Tool tool)
        {
            return new ToolTreeNode { Text = tool.Name + @" (" + tool.Description + @")", Tag = tool.Id, Name = tool.Id.ToString() };
        }
        
        public static TreeNode ToTreeNode(this FrequencyType frequencytype)
        {
            return new FrequencyTreeNode { Text = frequencytype.Name , Tag = frequencytype.Id, Name = frequencytype.Id.ToString() };
        }
    }
}